package bean;

import java.sql.SQLException;

/**
 * @author 李夏
 * @version 1.0
 */
public class Result {
    private Integer code;
    private String errMsg;
    private Object data;

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getErrMsg() {
        return errMsg;
    }

    public void setErrMsg(String errMsg) {
        this.errMsg = errMsg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
    public void success(Object object) {
        this.data = object;
        this.code = 200;
        this.errMsg ="";
    }
    public void failToLogin(){
        this.data=null;
        this.code=-1;
        this.errMsg="用户不存在";
    }
    public void imCompleteLogin(){
        this.data=null;
        this.code=-1;
        this.errMsg="用户名或密码为空";
    }

    public void imCompleteSign(){
        this.data=null;
        this.code=-1;
        this.errMsg="输入的信息不够完善";
    }

    public void fail(String e) {
        this.data = null;
        this.errMsg=e;
        this.code = -1;
    }
    public void fail() {
        this.data = null;
        this.errMsg="";
        this.code = -2;
    }
}
